package com.smz.controller;

import com.smz.entity.TPar;
import com.smz.service.TRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
public class TRelationController {


    @Autowired
    TRelationService tRelationService;

    @PostMapping("/relation/{mage}")
    public ResponseEntity<String> addRelation(@RequestBody TPar tPar, @PathVariable("mage")String mage){
        return ResponseEntity.ok(tRelationService.addTRelation(tPar,mage));
    }
    @DeleteMapping("/relation/{kid}")
    public ResponseEntity<Integer> deleteRelation(@PathVariable int kid){
        return ResponseEntity.ok(tRelationService.removeRelation(kid));
    }
}
